#include <iostream>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#define FIFO_FILE "./fifo"

#define EXIT_FAILURE 1

#define ERR_EXIT(m) \
do \
{ \
    perror(m); \
    exit(EXIT_FAILURE); \
} while(0)

const int gmode = 0x666;

class Fifo_Make
{
public:
    Fifo_Make(const std::string& s)
        :ps(s)
        ,fd(0)
    {
        ;
    }

    void Create()
    {
        int ret = mkfifo(ps.c_str(),gmode);

        if(ret < 0)
        {
            ERR_EXIT("mkfifo");
        }
    }

    const char* str()
    {
        return ps.c_str();
    }
private:
    std::string ps;
};

class Fifo_Oper
{
    Fifo_Oper()
    {
        ;
    }
};